package controllers

import (
	"github.com/astaxie/beego"
	"Fblog/models"
	"strings"
	"github.com/astaxie/beego/logs"
)

//首页
type IndexController struct {
	beego.Controller
}

func (c *IndexController) Get() {
	c.TplName = "index.html"
	page := models.Page{Page:1, Rows:20}

	category := strings.TrimSpace(c.Input().Get("cat"))

	logs.Info("index + cat  = " + category)
	c.Data["Topics"], _ = models.GetAllTopics(category, "", true, page)

	//只显示前20个分类
	c.Data["Categories"], _ = models.GetAllCategories(page)

	c.Data["IsHome"] = true
	c.Data["Dir"] = beego.AppConfig.String("Dir")

}
